/**
 * Copyright (c) 2006 Amgad S Youssef
 * All Rights Reserved.
 * Licensed under the Eclipse Public License - v 1.0
 * For more information see http://www.eclipse.org/legal/epl-v10.html
 */
package org.eclipsejcde.core.launchers;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

import org.eclipsejcde.core.JCDECore;

/**
 * @author Amgad S Youssef
 *
 */
public class CREFLauncher extends AbstractLauncher {
	private static CREFLauncher crefLauncher;

	public static ILauncher getLauncher() {
		if (crefLauncher == null) {
			crefLauncher = new CREFLauncher();
		}
		return crefLauncher;
	}

	@Override
	protected Map<String, Comparable> getLaunchConfigurationAttributes(String arguments) {
		Map<String, Comparable> attributes = new HashMap<String, Comparable>();
		attributes.put("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", new Boolean(true));
		attributes.put("org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND", new Boolean(true));
		attributes.put("org.eclipse.debug.core.capture_output", new Boolean(true));
		attributes.put("org.eclipse.debug.ui.ATTR_CONSOLE_OUTPUT_ON", new Boolean(true));
		attributes.put("org.eclipse.ui.externaltools.ATTR_LOCATION", JCDECore.getCurrentJCDKHome() + File.separator + "bin" + File.separator + "cref.exe");
		attributes.put("org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS", arguments);
		attributes.put("org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY", JCDECore.getCurrentJCDKHome() + File.separator + "bin");
		return attributes;
	}

	@Override
	protected String getLaunchConfigurationTypeID() {
		return "org.eclipse.ui.externaltools.ProgramLaunchConfigurationType";
	}

	@Override
	protected String getLauncherName() {
		return "CREF Simulator";
	}

}
